import 'package:json_annotation/json_annotation.dart';

part 'weather_today_model.g.dart';

@JsonSerializable()
class WeatherTodayModel {
  final String? reason;
  final Result? result;
  @JsonKey(name: 'error_code')
  final int? errorCode;

  const WeatherTodayModel({
    this.reason,
    this.result,
    this.errorCode,
  });

  factory WeatherTodayModel.fromJson(Map<String, dynamic> json) =>
      _$WeatherTodayModelFromJson(json);

  Map<String, dynamic> toJson() => _$WeatherTodayModelToJson(this);
}

@JsonSerializable()
class Result {
  final String? city;
  final Realtime? realtime;
  final List<Future>? future;

  const Result({
    this.city,
    this.realtime,
    this.future,
  });

  factory Result.fromJson(Map<String, dynamic> json) =>
      _$ResultFromJson(json);

  Map<String, dynamic> toJson() => _$ResultToJson(this);
}

@JsonSerializable()
class Realtime {
  final String? temperature;
  final String? humidity;
  final String? info;
  final String? wid;
  final String? direct;
  final String? power;
  final String? aqi;

  const Realtime({
    this.temperature,
    this.humidity,
    this.info,
    this.wid,
    this.direct,
    this.power,
    this.aqi,
  });

  factory Realtime.fromJson(Map<String, dynamic> json) =>
      _$RealtimeFromJson(json);

  Map<String, dynamic> toJson() => _$RealtimeToJson(this);
}

@JsonSerializable()
class Future {
  final String? date;
  final String? temperature;
  final String? weather;
  final Wid? wid;
  final String? direct;

  const Future({
    this.date,
    this.temperature,
    this.weather,
    this.wid,
    this.direct,
  });

  factory Future.fromJson(Map<String, dynamic> json) =>
      _$FutureFromJson(json);

  Map<String, dynamic> toJson() => _$FutureToJson(this);
}

@JsonSerializable()
class Wid {
  final String? day;
  final String? night;

  const Wid({
    this.day,
    this.night,
  });

  factory Wid.fromJson(Map<String, dynamic> json) =>
      _$WidFromJson(json);

  Map<String, dynamic> toJson() => _$WidToJson(this);
}
